package me.zhengjie.modules.monitor.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import me.zhengjie.modules.monitor.domain.TbCarDevOnline;
import me.zhengjie.modules.monitor.domain.vo.CarDevOnlineCriteria;
import me.zhengjie.modules.monitor.mapper.TbCarDevOnlineMapper;
import me.zhengjie.modules.monitor.service.CarDevOnlineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


import java.util.Collections;
import java.util.List;

@Service
public class CarDevOnlineServiceImpl extends ServiceImpl<TbCarDevOnlineMapper, TbCarDevOnline> implements CarDevOnlineService {

	@Autowired
	TbCarDevOnlineMapper carDevOnlineMapper;

	@Override
	public IPage<TbCarDevOnline> queryCarDevOnline(CarDevOnlineCriteria criteria) {
		Page<TbCarDevOnline> page = new Page<>(criteria.getOffset(), criteria.getSize());
		QueryWrapper<TbCarDevOnline> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq(ObjectUtil.isNotEmpty(criteria.getDevId()), "id", criteria.getDevId());
		return carDevOnlineMapper.selectPage(page, queryWrapper);
	}
}
